#!/bin/sh
#
# ufs910        This starts kathrein TV driver and frontend.
#
# chkconfig: 3 81 0
# description: 
#
# pidfile: 

PATH=/sbin:/bin:/usr/bin:/usr/sbin
RETVAL=0
NAME="start.sh"
prog="ufs910"

# Set environment values (see /etc/default/ufs910)
AUTOSTART_TV=no
[ -f /etc/default/ufs910 ] && . /etc/default/ufs910

# Check marker file for installation mode
[ -f /root/.install ] && AUTOSTART_TV=no

[ "${AUTOSTART_TV}" != "yes" ] && exit 0

start(){
	echo -n "Starting UFS910 start script: "

	mount --bind /etc /etc.static

	export LD_LIBRARY_PATH=/var/lib:/app/usr/lib

	if [ -f /config/start-ext.sh ]; then
        	/config/start-ext.sh &
        	echo "/config/start-ext.sh."
	else
        	/app/start.sh &
        	echo "/app/start.sh."
	fi

	RETVAL=$?
}

stop(){
    echo -n $"Stopping $prog: "

    RETVAL=$?
    echo "ok"

}

reload(){
    echo -n $"Reloading configuration: "	

    RETVAL=$?
    echo
}

restart(){
    stop
    start
}

# See how we were called.
case "$1" in
    start)
	start
	;;
    stop)
	stop
	;;
    restart)
	restart
	;;
    reload)
	reload
	;;
    *)
	echo $"Usage: $0 {start|stop|restart|reload}"
	RETVAL=1
esac
exit $RETVAL
